package dujiu.luogu.circulation;

import java.util.Scanner;

public class P1420 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        if (n == 0) {
            System.out.println(0);
            return;
        }

        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = scanner.nextInt();
        }

        if (n == 1) {
            System.out.println(1);
            return;
        }

        int maxCount = 1; // 最大连续递增序列长度
        int currentCount = 1; // 当前连续递增序列长度

        for (int i = 0; i < arr.length - 1; i++) {
            if (arr[i] + 1 == arr[i + 1]) {
                currentCount++;
                if (currentCount > maxCount) {
                    maxCount = currentCount;
                }
            } else {
                currentCount = 1; // 重置当前长度
            }
        }

        System.out.println(maxCount);
    }
}